import 'package:flutter/material.dart';
import 'package:package_info/package_info.dart';
import 'package:shudu/utils/global.dart';
import 'package:shudu/widget/appbar_widget.dart';

class AboutPage extends StatefulWidget {
  const AboutPage({Key? key}) : super(key: key);

  @override
  State<AboutPage> createState() => _AboutPageState();
}

class _AboutPageState extends State<AboutPage> {
  String version = "";

  @override
  void initState() {
    super.initState();

    loadVersion();
  }

  void loadVersion() {
    PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
      setState(() {
        version = packageInfo.version;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          AppbarWidget("关于我们"),
          Expanded(
              child: ListView(
            padding: const EdgeInsets.all(15),
            children: const [
              Text(
                "一款经典版数独游戏，多种难度关卡供你选择，海量题库等你来玩，帮助训练你的大脑。",
                style: TextStyle(
                    color: Colors.black, fontSize: 17),
              ),
            ],
          )),
          SafeArea(
              child: Text(
            "v $version",
            style: const TextStyle(fontSize: 11),
          ))
        ],
      ),
    );
  }
}
